package com.tools.web.filter.gateway;

import com.tools.common.io.CharsetEnum;
import com.tools.common.object.Note;
import com.tools.web.filter.cors.CorsFilter;
import com.tools.web.interceptor.auth.AuthenticationManager;

import javax.servlet.Filter;

/**
 * 网关过滤器。可以限制直连 IP、禁用接口、客户端 IP 白黑名单、拉黑 IP 等功能
 * */
@Note("网关过滤器。可以限制直连 IP、禁用接口、客户端 IP 白黑名单、拉黑 IP 等功能")
public interface GatewayManager extends Filter {

    @Note("是否开启了 “直连 IP 校验” 功能")
    boolean enabledProxyWhites();

    @Note("是否开启了 “REST 接口禁用” 功能")
    boolean enabledDisabledURIs();

    @Note("是否开启了 “客户端 IP 访问白名单” 功能")
    boolean enabledIpWhites();

    @Note("是否开启了 “客户端 IP 访问黑名单” 功能")
    boolean enabledIpBlacks();

    GatewayManager addInProxyWhites(String remote);

    GatewayManager addAllInProxyWhites(String... remotes);

    GatewayManager addAllInProxyWhites(Iterable<String> remotes);

    GatewayManager removeFromProxyWhites(String remote);

    GatewayManager removeAllFromProxyWhites(String... remotes);

    GatewayManager removeAllFromProxyWhites(Iterable<String> remotes);

    GatewayManager clearProxyWhites();

    boolean isInProxyWhites(String remote);

    boolean isAllInProxyWhites(String... remotes);

    boolean isAllInProxyWhites(Iterable<String> remotes);

    boolean isAnyInProxyWhites(String... remotes);

    boolean isAnyInProxyWhites(Iterable<String> remotes);

    GatewayManager addInDisabledURIs(String uri);

    GatewayManager addAllInDisabledURIs(String... uris);

    GatewayManager addAllInDisabledURIs(Iterable<String> uris);

    GatewayManager removeFromDisabledURIs(String uri);

    GatewayManager removeAllFromDisabledURIs(String... uris);

    GatewayManager removeAllFromDisabledURIs(Iterable<String> uris);

    GatewayManager clearDisabledURIs();

    boolean isInDisabledURIs(String uri);

    boolean isAllInDisabledURIs(String... uris);

    boolean isAllInDisabledURIs(Iterable<String> uris);

    boolean isAnyInDisabledURIs(String... uris);

    boolean isAnyInDisabledURIs(Iterable<String> uris);

    GatewayManager addInIpWhites(String clientIP);

    GatewayManager addAllInIpWhites(String... clientIps);

    GatewayManager addAllInIpWhites(Iterable<String> clientIps);

    GatewayManager removeFromIpWhites(String clientIP);

    GatewayManager removeAllFromIpWhites(String... clientIPs);

    GatewayManager removeAllFromIpWhites(Iterable<String> clientIPs);

    GatewayManager clearIpWhites();

    boolean isInIpWhites(String clientIP);

    boolean isAllInIpWhites(String... clientIPs);

    boolean isAllInIpWhites(Iterable<String> clientIPs);

    boolean isAnyInIpWhites(String... clientIPs);

    boolean isAnyInIpWhites(Iterable<String> clientIPs);

    GatewayManager addInIpBlacks(String clientIP);

    GatewayManager addInIpBlacks(String... clientIPs);

    GatewayManager addInIpBlacks(Iterable<String> clientIPs);

    GatewayManager removeFromIpBlacks(String clientIP);

    GatewayManager removeAllFromIpBlacks(String... clientIPs);

    GatewayManager removeAllFromIpBlacks(Iterable<String> clientIPs);

    GatewayManager clearIpBlacks();

    boolean isInIpBlacks(String clientIP);

    boolean isAllInIpBlacks(String... clientIPs);

    boolean isAllInIpBlacks(Iterable<String> clientIPs);

    boolean isAnyInIpBlacks(String... clientIPs);

    boolean isAnyInIpBlacks(Iterable<String> clientIPs);

    AuthenticationManager getAuthenticationManager();

    CorsFilter getCorsFilter();

    String getResponseContentType();

    String getResponseCharset();

    CharsetEnum getResponseCharsetEnum();

    String getProxyWhitesCacheKey();

    String getDisableURICacheKey();

    String getIpWhitesCacheKey();

    String getIpBlacksCacheKey();
}
